package lumingweihua.future.cn.lumingweihua;

import android.text.TextUtils;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import lumingweihua.future.cn.baselibgxh.base.BaseActivity;
import lumingweihua.future.cn.baselibgxh.utils.Constant;

/**
 * Created by Administrator on 2018/3/2.
 */

public class WebViewActivity extends BaseActivity {
    @Override
    protected void initView() {
        setContentView(R.layout.common_webview);
        initTitleBar("", Constant.DEFAULT_LEFT_BACK,"");

        WebView mWebView = (WebView) findViewById(R.id.common_webview);

        mWebView.setWebViewClient(new WebViewClient());
        mWebView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
            }

            @Override
            public void onReceivedTitle(WebView view, String title) {
                super.onReceivedTitle(view, title);
            }


        });

        String url = getIntentExtra("url");
        if(!TextUtils.isEmpty(url)){
            if(url.startsWith("http"))
                mWebView.loadUrl(url);
            else
                mWebView.loadDataWithBaseURL(null, url, "text/html" , "utf-8", null);
        }


        if(!getIntentExtra("isshowtitlebar", true)){
            findViewById(R.id.title_bar).setVisibility(View.GONE);
        }
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void processClick(View v) {

    }
}
